//Ta Duc Viet
//Dem, tra ve ki tu xuat hien nhieu nhat
#include <iostream>
#include <string>

using namespace std;

int arr[26] = {0}; // arr[0]: tan suat ki tu a;
                   // arr[25]: tan suat ki tu z;
int main(){
	string str;
    char check;
	int n = 0;
    do{
		n++;
        cout << "Nhap xau:";
        fflush(stdin);
        getline(cin,str);
        for ( int i = 0; i < str.length(); i++){
            if ( str[i] >= 'a' && str[i] <= 'z'){
                arr[str[i] - 'a'] ++;
            }
        }
        cout << "Nhap tiep (c/k)?";
        fflush(stdin);
        cin >> check;
    }
    while (check == 'c' && n < 30);
    int max = 0;
    for ( int i = 1; i < 26; i++){
        if ( arr[i] > arr[max]) max = i;
    }
    cout << "Chu cai xuat hien nhieu nhat:'" << char ('a' + max) << "'" << endl;
    system("pause");
    return 0;
}
	
	